Skip to content

deps: Bump AngleSharp and HtmlSanitizer - #540

Merged
MPCoreDeveloper merged 2 commits into
masterfrom
dependabot/nuget/multi-f006937c38
Nov 30, 2026
Merged

MPCoreDeveloper merged 2 commits into
masterfrom
dependabot/nuget/multi-f006937c38

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Nov 30, 2026

Copy link
Copy Markdown
Contributor

Updated AngleSharp from 1.10.5 to 1.11.0.

Release notes

Sourced from AngleSharp's releases.

1.11.0

Released on Tuesday, November 24 2026.

What's Changed

  • Improved performance of parsing CSS selectors, cutting 15-30% of the time and 20-35% of the allocations
  • Improved performance of matching :nth-child(), :nth-last-child(), :only-child, the sibling combinators (+, ~) and [attr~=value] (up to 70% less time)
  • Improved performance of finding a node among its siblings (e.g. previousElementSibling, nextElementSibling), which usually no longer scans the parent's children
  • Improved performance of moving and removing many nodes while a MutationObserver is active
  • Improved performance of children, which is only gathered again once the child list changed
  • Updated img elements to request nothing by themselves
  • Fixed setting the value of an input or textarea not moving the cursor to its end
  • Fixed click() dispatching its click event later instead of before it returns
  • Fixed click() on a checkbox or radio button not checking it (and not firing input and change)
  • Fixed stopPropagation() in a capturing listener of an element still running its bubbling listeners
  • Fixed form.elements of a form not in the document being empty
  • Fixed a style sheet served as another type than text/css (e.g. text/html) being applied in standards mode
  • Fixed text documents (e.g. text/plain) never completing, i.e. no load event
  • Fixed setEnd of a new range moving its start along, and setStartBefore (and the like) not collapsing a range they reverse
  • Fixed comparing the boundary points of a range in sibling nodes, which made toString() and cloneContents() include text outside the range
  • Fixed Range.toString() taking the whole text of adjacent text nodes for each of them
  • Fixed cloneContents() and extractContents() of a range in the document itself throwing
  • Fixed ranges being changed by splitting, normalizing or editing text as if set by script (splitText also moved the start where the end belonged)
  • Fixed a NodeIterator returning the wrong node after its filter removed the node it looked at
  • Fixed createElementNS accepting qualified names with an empty prefix or local name (e.g. :div)
  • Fixed nth-child selector not accepting some valid combinations (#​1420) @​bardrop
  • Fixed TextSource.ReadMemory() returning pooled memory that could change after further reads, encoding changes, or disposal; direct underlying-source reads still borrow memory (#​1418)
  • Fixed a form with method="dialog" navigating instead of closing its dialog (with the value of the submitter as returnValue)
  • Fixed showModal() of an open or a disconnected dialog not throwing an InvalidStateError
  • Fixed scripts in a template running while it is parsed
  • Fixed innerHTML of a template not serializing its content
  • Fixed showPopover() of a shown popover throwing instead of doing nothing
  • Fixed attachShadow() of a shadow host throwing an InvalidStateError instead of a NotSupportedError
  • Fixed shadowRoot giving scripts a closed shadow root (C# still gets it via ShadowRoot)
  • Fixed the validity of a field staying invalid (badInput) once it had an invalid value
  • Fixed the value sanatization of date, month, week, time, datetime-local, number, range and color
  • Fixed labels of form controls, meter and progress always being empty
  • Fixed label.control not finding the control a label without for contains, and finding a hidden input
  • Fixed formEnctype of inputs and buttons being exposed as formEncType to scripts
  • Fixed toDataURL() of a canvas giving just the base64 of the image instead of a data: URL
  • Fixes for Running the ACID3 Test by @​FlorianRappl in Fixes for Running the ACID3 Test AngleSharp/AngleSharp#1422
  • Fixed a redirect with the status 308 not being followed
  • Fixed the parser duplicating a part of the document under certain conditions
  • Fixed the type of a menu not being toolbar by default
  • Fixed focus() moving the focus (and firing focus and blur) only in a later task
  • Fixed the contents of a template belonging to its document instead of an inert one (template.content.ownerDocument)
  • Fixed a click event a script dispatched not running the activation behavior
  • Fixed the submit event of a form submission not being trusted
  • Fixed a script with nomodule running even though module scripts are supported
  • Fixed a datetime-local value without seconds being sanitized to an empty string
  • Fixed the load event of a document not waiting for what started loading after the document was parsed but before it finished loading
    ... (truncated)

Commits viewable in compare view.

Updated HtmlSanitizer from 11.0.26 to 11.0.74.

Release notes

Sourced from HtmlSanitizer's releases.

11.0.74

Security hardening

Style declarations that the CSS parser does not read back are no longer kept

SanitizeStyle wrote AngleSharp.Css's normalized text into the style attribute before checking anything, and then checked only the declarations it read back from that text. A declaration that did not read back stayed in the attribute without being checked at all: AllowedCssProperties, DisallowCssPropertyValue and the URL checks were never applied to it.

The sanitizer now fails closed in both places this could happen. If nothing reads back, the attribute is removed. If the declarations that read back do not account for the whole attribute text, the block is rewritten from those declarations even when none of them had to be changed, so the unchecked remainder goes with it.

The default configuration is not affected: AngleSharp.Css reads back everything it serializes, over a sweep of 56 properties by 71 values of which 910 pairs parsed. Reaching the gap takes a CSS parser that is stricter than that serializer, which a custom IDeclarationFactory or a HtmlParserFactory with a non-default CSS configuration can introduce — a parser refusing values with a backslash, for instance, accepts font-family: 'a"b' as written but refuses the "a\"b" it serializes to. Upgrade if you configure either of those.

One side note for custom formatters: a StyleFormatter whose output does not serialize identically after being parsed again now has its declaration blocks rewritten with the default formatting.

Performance

Tag and comment removal is applied one parent at a time

Removing disallowed tags and comments node by node is quadratic on wide input, because AngleSharp locates a child inside its parent by scanning the child list. Removal decisions are now collected first and each affected parent's child list is rebuilt in one pass. On 320k siblings, SanitizeDom goes from 88.9 s to 0.6 s for comments and from 229.7 s to 0.5 s for unwrapping with KeepChildNodes. Parents with 32 children or fewer take exactly the path they took before, so ordinary documents are unaffected.

Two parts of this are still outstanding, both of them unchanged in this release:

  • Attribute removal is still one attribute at a time and still quadratic in the number of attributes on one element.
  • End-to-end Sanitize remains quadratic on wide input for a reason outside this code: AngleSharp's Node.ToHtml scans for NextSibling per childless node, which costs 57 s on 2.5 MB of clean, fully allowed markup with nothing removed at all. This needs fixing upstream.

RemovingTag and RemovingComment are raised before anything is removed

Both events are still raised for every node in document order and can still cancel. The one change a handler can observe is that it now runs before any node has been removed, rather than between removals. A handler that inspected the surrounding document while removals were in progress sees the untouched document instead.

Dependencies

  • AngleSharp: 1.10.0 → 1.11.0
  • AngleSharp.Css: 1.4.0 → 1.6.0
  • System.Collections.Immutable (net462, net47, netstandard2.0 only): 10.0.14 → 11.0.0

Credits

vincentparrett for reporting both the unchecked style declarations and the quadratic removal.

Commits viewable in compare view.

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps AngleSharp from 1.10.5 to 1.11.0
Bumps HtmlSanitizer from 11.0.26 to 11.0.74

---
updated-dependencies:
- dependency-name: AngleSharp
  dependency-version: 1.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: HtmlSanitizer
  dependency-version: 11.0.74
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added the dependencies Pull requests that update a dependency file label Nov 30, 2026
@dependabot @github

dependabot Bot commented on behalf of github Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Labels

The following labels could not be found: nuget. Please create it before Dependabot can add it to a pull request.

Please fix the above issues or remove invalid values from dependabot.yml.

@codecov

codecov Bot commented Nov 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

Copy link
Copy Markdown

@MPCoreDeveloper
MPCoreDeveloper merged commit 17f2655 into master Nov 30, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant